package com.zhaojonhy.zhaopangwb.Fragment;

import android.app.Activity;
import android.support.v4.app.Fragment;
import android.content.Intent;
import android.os.Bundle;

import com.zhaojonhy.zhaopangwb.ui.MainActivity;
import com.zhaojonhy.zhaopangwb.ui.UserInfoActivity;

/**
 * Created by Administrator on 2016/9/5.
 */
public class BaseFragment extends Fragment {

    protected MainActivity activity ;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        activity = (MainActivity) getActivity() ;

    }
    protected void intent2Activity(Class<? extends Activity> tarActivity) {
        Intent intent = new Intent(activity,tarActivity) ;
        startActivity(intent);
    }

    protected void intent2Activity(Class<? extends Activity> tarActivity,String str) {
        Intent intent = new Intent(activity,tarActivity) ;
        intent.putExtra(str,true) ;
        startActivity(intent);
    }

    public void setCallBackFuc(MainActivity activity){
        this.activity = activity ;
    };

    public void OnReceive(){
        activity.callback();
    }
}
